// 存在性
var obj={
    a:2
}
console.log("a" in  obj);
console.log("b" in obj);
console.log(obj.hasOwnProperty("a"));
console.log(obj.hasOwnProperty("B"));
console.log('-------');
// 可枚举属性
var myObject = { }; 
Object.defineProperty( 
 myObject, 
 "a", 
 // 让 a 像普通属性一样可以枚举
 { enumerable: true, value: 2 } 
); 
Object.defineProperty( 
 myObject, 
 "b", 
 // 让 b 不可枚举
 { enumerable: false, value: 3 } 
); 
console.log(myObject.b); // 3 
console.log("b" in myObject); // true 
console.log(myObject.hasOwnProperty( "b" )); // true 
// ....... 
for (var k in myObject) { 
 console.log( k, myObject[k] ); // 遍历不出来不可枚举
} 
// "a" 2
// 判断是否可以枚举
console.log(myObject.propertyIsEnumerable("a"));// true
console.log(myObject.propertyIsEnumerable("b"));// false
console.log(Object.keys(myObject));//['a']
console.log(Object.getOwnPropertyNames(myObject));//['a','b']

